Page({
    data: {
        goods: '', //商品名称
        price: '', //商品价格
        goods_level: '', //商品等级
        goods_mature: [], //成熟度
        goods_color: [], //颜色
        packing: '', //包装费
        freight: '', //运费
        Initial_sales: '', //起卖数
        fileList: [], //上传品种确认图片数组
        max_count: 2, //付款凭证图片可上传数量
        level_items: [
            { value: 'A', name: 'A' },
            { value: 'B', name: 'B' },
            { value: 'C', name: 'C' }
        ], //商品等级单选框选项数组
        mature_items: [
            { value: '生', name: '生' },
            { value: '中熟', name: '中熟' },
            { value: '偏熟', name: '偏熟' }
        ], //成熟度复选框选项数组
        color_items: [
            { value: '单色混搭', name: '单色混搭' },
            { value: '红', name: '红' },
            { value: '橙', name: '橙' },
            { value: '黄', name: '黄' },
            { value: '绿', name: '绿' },
            { value: '蓝', name: '蓝' }
        ], //颜色复选框选项数组
    },
    //选择商品等级
    handleLevelChange(e) {
        this.setData({ goods_level: e.detail })
    },
    //选择成熟度
    handlematureChange(e) {
        this.setData({ goods_mature: e.detail })
    },
    //选择颜色
    handleColorChange(e) {
        this.setData({ goods_color: e.detail})
    },
    afterRead(event) {
        const { file } = event.detail;
        let { fileList = [] } = this.data;
        file.forEach(item => {
            fileList.push(item);
        })
        this.setData({ fileList });
        // 当设置 mutiple 为 true 时, file 为数组格式，否则为对象格式
        // wx.uploadFile({
        //     url: 'https://example.weixin.qq.com/upload',
        //     filePath: file.url,
        //     name: 'file',
        //     formData: { user: 'test' },
        //     success(res) {
        //         // 上传完成需要更新 fileList
        //         const { fileList = [] } = this.data;
        //         fileList.push({ ...file, url: res.data });
        //         this.setData({ fileList });
        //     },
        // });
    },
    delete_image(e) {
        let { fileList = [] } = this.data;
        fileList.splice(e.detail.index, 1);
        this.setData({ fileList });
    },
    release_product() {

    },
    onLoad: function(options) {

    }
})